#!/bin/bash
#2017-09-23 1348
t=$(date +%m%d)
lt=$(date +%Y%m%d%H%M)
f="部署集控服务开机启动"
cf="取消部署集控服务开机启动"
g="部署客户端开机启动"
ga="部署客户端开机启动(自动登录用户--autoLoginUser)"
cga="取消部署客户端开机启动"
dc="客户端桌面快捷方式"
dca="客户端桌面快捷方式(自动登录用户--autoLoginUser)"
ds="集控服桌面快捷方式"
zz="================"
z="返回上一级"

temp="/work/temp"
bak_file="bakfile"
logn="logname"

echo "`pwd`"
function f_select(){
    PS3=-'请输入对应的数字选择要执行的操作！'
    select slt in ${f} ${cf} ${zz} ${g} ${ga} ${cga} ${zz} ${dc} ${dca} ${ds} ${z}; do
        case ${slt} in
        "${f}")
            logn=${f}
            cd autoStart
            ./autoStart-Phoenix.sh autoJKServer
            cd ..
            f_log
            break
            ;;
        "${cf}")
            logn=${cf}
            cd autoStart
            ./autoStart-Phoenix.sh delJKServer
            cd ..
            f_log
            break
            ;;
        "${g}")
            logn=${g}
            cd autoStart
            ./autoStart-Phoenix.sh autostart
            cd ..
            f_log
            break
            ;;
        "${ga}")
            logn=${ga}
            cd autoStart
            ./autoStart-Phoenix.sh autoLogin
            cd ..
            f_log
            break
            ;;
        "${cga}")
            logn=${cga}
            cd autoStart
            ./autoStart-Phoenix.sh delautostart
            cd ..
            f_log
            break
            ;;
        "${dc}")
            logn=${dc}
            cd autoStart
            ./desktop-Phoenix.sh desktop
            cd ..
            f_log
            break
            ;;
        "${dca}")
            logn=${dca}
            cd autoStart
            ./desktop-Phoenix.sh autoLogin
            cd ..
            f_log
            break
            ;;
        "${ds}")
            logn=${ds}
            cd autoStart
            ./desktop-Phoenix.sh JKServer
            cd ..
            f_log
            break
            ;;
        "${z}")
            echo 'bay,bay!!'
            exit
            ;;
        *)
            echo  "输入错误，请重新选择！"
            break
            ;;
        esac
    done
    f_select
}
function f_log(){
    if [ ! -d ${PWD}/log ]; then
        mkdir ${PWD}/log
        chmod 755 -R ${PWD}/log
    fi
    if [ ! -e ${PWD}/log/bak.log ]; then
        touch ${PWD}/log/bak.log
    fi
	#echo  "[" ` date '+%F %T %3N'`"]:">> ${PWD}/log/bak.log ##时间
    echo ${PWD}
    echo "["` date '+%F %T %3N'`"]:""选择了"${slt}  >> ${PWD}/log/bak.log
    echo "["` date '+%F %T %3N'`"]:""执行"${logn} >> ${PWD}/log/bak.log
}
f_select

